Teaching Computers to See Patterns in Scatterplots with Scagnostics

Abstract:

An abstract of less than 150 words.

Cite PDF Tweet
Harriet Mason https://www.britannica.com/animal/quokka (Monash University) , Stuart Lee https://stuartlee.org (Genentech) , Ursula Laa https://uschilaa.github.io (University of Natural Resources and Life Sciences) , Dianne Cook https://dicook.org (Monash University)

Introduction

Visualising high dimensional data is often difficult and requires a trade-off between the usefulness of the plots and maintaining the structures of the original data. Scagnostics (scatterplot diagnostics) are a set of visual features that can be used to identify interesting and abnormal scatterplots, and thus give a sense of priority to the variables we choose to visualise. This proposal will discuss the creation of an R package that will provide a user-friendly method to calculate these scagnostics. The package will be tested on datasets with known interesting visual features to ensure the scagnostics are working as expected, before finally being used to explore and describe a time series dataset.

As the number of dimensions in a dataset increases, the process of visualising its structure and variable dependencies becomes more tedious. This is because the number of possible pairwise plots rises exponentially with the number of dimensions. Datasets like Anscombe’s quartet (Anscombe 1973) or the datasaurus dozen (Locke and D’Agostino McGowan 2018) have been constructed such that each pairwise plot has the same summary statistics but strikingly different visual features. This design is to illustrate the pitfalls of numerical summaries and the importance of visualisation. This means that despite the issues that come with increasing dimensionality, visualisation of the data cannot be ignored. Scagnostics offer one possible solution to this issue.

The term scagnostics was introduced by John Tukey in 1982 (Tukey 1988). Tukey discusses the value of a cognostic (a diagnostic that should be interpreted by a computer rather than a human) to filter out uninteresting visualisations. He denotes a cognostic that is specific to scatter plots a scagnostic. Up to a moderate number of variables, a scatter plot matrix (SPLOM) can be used to create pairwise visualisations, however, this solution quickly becomes infeasible. Thus, instead of trying to view every possible variable combination, the workload is reduced by calculating a series of visual features, and only presenting the outlier scatter plots on these feature combinations.

There is a large amount of research into visualising high dimensional data, most of which focuses on some form of dimension reduction. This can be done by creating a hierarchy of potential variables, performing a transformation of the variables, or some combination of the two. Unfortunately none of these methods are without pitfalls. Linear transformations are subject to crowding, where low level projections concentrate data in the centre of the distribution, making it difficult to differentiate data points (Diaconis and Freedman 1984). Non-linear transformations often have complex parameterisations, and can break the underlying global structure of the data, creating misleading visualisations. While there are solutions within these methods to fix these issues such as a burning sage tour for crowding (U. Laa, Cook, and Lee 2020) or liminal package for maintaining global structure (Lee, Laa, and Cook 2020) all these methods still involve some transformation of the data. Scagnostics gives the benefit of allowing the user to view relationships between the variables in their raw form. This means they are not subject to the linear transformation issue of crowding, or the non-linear transformation issue of misleading global structures. That being said, only viewing pairwise plots can leave our variable interpretations without context. Methods such as those shown in ScagExplorer (Dang and Wilkinson 2014) try to address this by visualising the pairwise plots in relation to the scagnostic measures distribution, but ultimately the lack of context remains one of the limitations of using scagnostics alone as a dimension reduction technique.

Scagnostics are not only useful in isolation, they can be applied in conjunction with other techniques to find interesting feature combinations of the transformed variables. The tourr projection pursuit currently uses a selection of scagnostics to identify interesting low level projections and move the visualisation towards them (U. Laa and Cook 2020). Since scagnostics are not dependent on the type of data, they can also be used to compare and contrast scatter plots regardless of the discipline. In this way, they are a useful metric for something like the comparisons described in A self-organizing, living library of time-series data, which tries to organise time series by their features instead of on their metadata (Fulcher et al. 2020).

Several scagnostics have been previously defined in Graph-Theoretic Scagnostics (L. Wilkinson, Anand, and Grossman 2005), which are typically considered the basis of the visual features. They were all constructed to range [0,1], and later scagnostics have maintained this scale. The formula for these measures were revised in Scagnostic Distributions and are still calculated according to this paper (Leland Wilkinson and Wills 2008). In addition to the main nine, the benefit of using two additional association scagnostics were discussed in Katrin Grimm’s PhD thesis (Grimm 2016). These two association measures are also used in the tourr projection pursuit (U. Laa and Cook 2020).

There are two existing scagnostics packages, scagnostics (Leland Wilkinson and Wills 2008) and the archived package binostics (Ursula Laa et al. 2020). Both are based on the original C++ code from Scagnostic Distributions (something?), which is difficult to read and difficult to debug. Thus there is a need for a new implementation that enables better diagnosis of the scagnostics, and better graphical tools for examining the results.

This paper describes the R package, cassowaryr that computes the currently existing scagnostics, and adds several new measures. The paper is organised as follows. The next section explains the scagnostics. This is followed by a description of the implementation. Several examples using collections of time series and XXX illustrate the usage.

Scagnostics

Building blocks for the graph-based metrics

In order to capture the visual structure of the data, graph theory is used to calculate most of the scagnostics. The pairwise scatter plot is re-constructed as a graph with the data points as vertices and the edges are calculated using Delaunay triangulation. In the package this calculation is done using the alphahull package (Pateiro-Lopez, Rodriguez-Casal, and. 2019) to construct an object called a scree. This is the basis for all the other objects that are used to calculate the scagnostics (except for monotonic, dcor and splines which use the raw data). The graph (screen object) is then used to construct the three key structures on which the scagnostics are based; the convex hull, alpha hull and minimum-spanning tree (MST).

The building blocks for graph-based scagnostics

(#fig:building-blocks2)The building blocks for graph-based scagnostics

Graph-based scagnostics

The nine scagnostics defined in Scagnostic Distributions are detailed below with an explanation, formula, and visualisation. We will let A= alpha Hull C= convex hull, M = minimum spanning tree, and s= the scagnostic measure. Since some of the measures have some sample size dependence, we will let w be a constant that adjusts for that.

\[s_{convex}=w\frac{area(A)}{area(C)}\]

\[s_{skinny}= 1-\frac{\sqrt{4\pi area(A)}}{perimeter(A)}\]

\[s_{outlying}=\frac{length(M_{outliers})}{length(M)}\]

\[s_{stringy} = \frac{|V^{(2)}|}{|V|-|V^{(1)}|}\]

\[s_{skewed} = 1-w(1-\frac{q_{90}-{q_{50}}}{q_{90}-q_{10}})\]

\[s_{sparse}= wq_{90}\]

\[\max_{j}[1-\frac{\max_{k}[length(e_k)]}{length(e_j)}]\]

\[\frac1{|V|}\sum_{v \in V^{2}}I(cos\theta_{e(v,a)e(v,b)}<-0.75)\]

\[s_{monotonic} = r^2_{spearman}\]

Association-based scagnostics

The two additional scagnostics discussed by Katrin Grimm are described below.

\[s_{splines}=\max_{i\in x,y}[1-\frac{Var(Residuals_{model~i=.})}{Var(i)}]\]

\[s_{dcor}= \sqrt{\frac{\mathcal{V}(X,Y)}{\mathcal{V}(X,X)\mathcal{V}(Y,Y)}}\]
where \[\mathcal{V} (X,Y)=\frac{1}{n^2}\sum_{k=1}^n\sum_{l=1}^nA_{kl}B_{kl}\]
where \[A_{kl}=a_{kl}-\bar{a}_{k.}-\bar{a}_{.j}-\bar{a}_{..}\] \[B_{kl}=b_{kl}-\bar{b}_{k.}-\bar{b}_{.j}-\bar{b}_{..}\]

Checking the scagnostics calculations

Maybe use Anscombe and datasaurus and the features data here

Software implementation

Installation

Data sets

Functions

Scagnostics functions

Drawing functions

Summary functions

Tests

Examples

Collections of time series

GOAL: Use scagnostics to find difference in shapes between groups. Here we want to first use features to describe a time series, and then secondly choosing pairs of features where there is the biggest difference between groups according to a scagnostic.

A paragraph describing the compenginets data

Analysis notes:

Compare two sets of time series

I think that this is a promising use of scagnostics. This reveals a big difference between the three types is in sparse and splines, which points to a few of the tsfeatures including curvature and entropy.

Need to refine this a lot more, and maybe just focus on differences between the three groups on each scagnostic.

(Maybe also think about including a climate time series?)

Parkinsons

Black holes and neutron star mergers?

AFL player statistics

Some explanation of AFL, and about the AFLW competition. Particularly explain any stats used in the plots: goals, kicks, posessions, …

Var1 Var2 splines
totalPossessions disposals 0.9419197
clearances.totalClearances clearances.stoppageClearances 0.8826420
goalAccuracy goals 0.8345651
metresGained kicks 0.7724382
dreamTeamPoints disposals 0.7432447
disposals kicks 0.7241803
dreamTeamPoints totalPossessions 0.7158814
totalPossessions uncontestedPossessions 0.6830528
dreamTeamPoints kicks 0.6664289
uncontestedPossessions disposals 0.6646738

(#fig:aflw_interactive)Scatterplots with high values on the splines scagnostic. Mouseover to examine the players relative the the statistics.

Figure @(fig:aflw_interactive) shows three scatterplots that score highly on the splines scagnostic. Each of these shows a relatively strong monotonic relationship between the two variables. In the interactive version of the plot, mouse over reveals some high-performing players, e.g. Anne Hatchard has a lot of possessions, disposals and kicks, and Kaitlyn Ashmore kicked 4 goals in a match with 100% accuracy.

NOTE: Each player is represented multiple times here, I think. The stats are per game. Maybe it is better to aggregate for each player and re-do the statistics?

(#fig:some_are_kickers)Some players tend to kick the ball, even when challenged, whereas others more often use handball for disposals.

World Development Indicators

The World Bank delivers a lot of development indicators, for many countries and multiple years. This might be a good example to identify pairs of indicators with interesting relationships.

Download data from:

https://databank.worldbank.org/source/world-development-indicators/preview/on#

Summary

Anscombe, F. J. 1973. “Graphs in Statistical Analysis.” The American Statistician 27 (1): 17–21. https://doi.org/10.1080/00031305.1973.10478966.
Csardi, Gabor, and Tamas Nepusz. 2006. “The Igraph Software Package for Complex Network Research.” InterJournal Complex Systems: 1695. https://igraph.org.
Dang, Tuan Nhon, and Leland Wilkinson. 2014. “ScagExplorer: Exploring Scatterplots by Their Scagnostics.” In 2014 IEEE Pacific Visualization Symposium, 73–80. https://doi.org/10.1109/PacificVis.2014.42.
Diaconis, Persi, and David Freedman. 1984. “Asymptotics of Graphical Projection Pursuit.” The Annals of Statistics 12 (3): 793–815. http://www.jstor.org/stable/2240961.
Fulcher, Ben D, Carl H Lubba, Sarab S Sethi, and Nick S Jones. 2020. “A Self-Organizing, Living Library of Time-Series Data.” Scientific Data 7 (1): 213–13.
Grimm, Katrin. 2016. “Kennzahlenbasierte Grafikauswahl.” Doctoral thesis, Universität Augsburg.
Laa, U., and D. Cook. 2020. Using Tours to Visually Investigate Properties of New Projection Pursuit Indexes with Application to Problems in Physics.” Computational Statistics 35: 1171–1205. https://doi.org/10.1007/s00180-020-00954-8.
Laa, U., D. Cook, and S. Lee. 2020. “Burning Sage: Reversing the Curse of Dimensionality in the Visualization of High-Dimensional Data.” arXiv: Computation.
Laa, Ursula, Hadley Wickham, Dianne Cook, and Heike Hofmann. 2020. “Binostics: Computing Scagnostics Measures in r and c++.” https://github.com/uschiLaa/paper-binostics.
Lee, Stuart, Ursula Laa, and Dianne Cook. 2020. “Casting Multiple Shadows: High-Dimensional Interactive Data Visualisation with Tours and Embeddings.” http://arxiv.org/abs/2012.06077.
Locke, Steph, and Lucy D’Agostino McGowan. 2018. datasauRus: Datasets from the Datasaurus Dozen. https://CRAN.R-project.org/package=datasauRus.
Pateiro-Lopez, Beatriz, Alberto Rodriguez-Casal, and. 2019. Alphahull: Generalization of the Convex Hull of a Sample of Points in the Plane. https://CRAN.R-project.org/package=alphahull.
Tukey, John. 1988. “The Collected Works of John w. Tukey.” In, edited by William S. Cleveland, 411, 427, 433. Chapman; Hall/CRC.
Wilkinson, L., A. Anand, and R. Grossman. 2005. “Graph-Theoretic Scagnostics.” In IEEE Symposium on Information Visualization, 2005. INFOVIS 2005., 157–64.
Wilkinson, Leland, and Graham Wills. 2008. “Scagnostics Distributions.” Journal of Computational and Graphical Statistics 17 (2): 473–91.

References

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".